package test;

import java.util.*;

public class hotel_test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int p = sc.nextInt();
        int[][] nums = new int[n][2];
        for (int i = 0; i < n; i++) {
            nums[i][0] = sc.nextInt();
            nums[i][1] = sc.nextInt();
        }
        int re = 0;
        for (int i = 0; i < n; i++) {
            int money = nums[i][1];
            for (int j = i + 1; j < n; j++) {
                money = Math.min(money, nums[j][1]);
                if(nums[i][0] == nums[j][0] && money <= p)
                    re++;
            }
        }
        System.out.println(re);
    }
}
